package com.duxd.springsecurityfinal.springsecurityfinal.mvc.controller;

import com.duxd.springsecurityfinal.springsecurityfinal.annotation.NeedAuthentication;
import com.duxd.springsecurityfinal.springsecurityfinal.pojo.School;
import com.duxd.springsecurityfinal.springsecurityfinal.response.Response;
import com.duxd.springsecurityfinal.springsecurityfinal.response.ResponseBuild;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author dong
 * @date 2022/1/15 0015
 */
@RestController()
@RequestMapping(value = "/school")
public class SchoolController {


    @NeedAuthentication(need = false)
    @GetMapping(value = "/all", produces = {"application/json;charset=UTF-8"})
    public Response<List<School>> findAll(){
        return ResponseBuild.request_success.data(School.buildList("qinghua", "beida"));
    }

    @GetMapping(value = "/detail", produces = {"application/json;charset=UTF-8"})
    public Response<School> findDetail(@RequestParam("id") String id){
        return ResponseBuild.request_success.data(new School("qinghua"));
    }
}
